import request from '@/utils/request'

export function find(baseWarehouseDTO) {
  return request({
    url: '/base/warehouse/find',
    method: 'get',
    params: baseWarehouseDTO
  })
}

export function add(baseWarehouse) {
  return request({
    url: '/base/warehouse/add',
    method: 'post',
    data: baseWarehouse
  })
}

export function update(baseWarehouse) {
  return request({
    url: '/base/warehouse/update',
    method: 'put',
    data: baseWarehouse
  })
}

export function deleteWarehouses(ids) {
  return request({
    url: '/base/warehouse/delete',
    method: 'delete',
    params: { ids }
  })
}

export function importBatch(file) {
  const formData = new FormData();
  formData.append('file', file);
  return request({
    url: '/base/warehouse/insertBatch',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}
